package com.joven.shelltest.controller;

import com.joven.shelltest.dto.RootCommentsDto;
import com.joven.shelltest.service.CommentsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 文章评论
 * @author wzj
 * @since 2024/11/8 9:39
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/comments")
public class CommentsController {

    private final CommentsService commentsService;

    @GetMapping("/getComments")
    public List<RootCommentsDto> getComments(Long id) {
        return commentsService.getCommentsByArticleId(id);
    }
}
